﻿@model List<OPLWeb.Models.Team>
<div class="module league-table" id="leaguetable-gadget">
    <div class="module-header">
        <h3>
            League table
        </h3>
    </div>
    <div class="module-body">
        <table cellspacing="0">
            <colgroup>
                <col id="col-no">
                <col id="col-name">
                <col id="col-pld">
                <col id="col-gd">
                <col id="col-pts">
            </colgroup>
            <thead>
                <tr>
                    <th class="c1">
                        <span class="vis-hidden">Pos.</span>
                    </th>
                    <th class="c2">
                        <span class="vis-hidden">Team name</span>
                    </th>
                    <th class="c3">
                        Pld
                    </th>
                    <th class="c4">
                        Win
                    </th>
                    <th class="c5">
                        Pts
                    </th>
                    <th class="c5">
                        Avg.
                    </th>
                </tr>
            </thead>
            <tbody>
                @{
                    var maxid = Model.Max(p => p.Points);
                    string myClass = null;
                }
                @for (int i = 0; i < Model.Count; i++)
                {
                    if (maxid == Model[i].Points)
                    {
                        myClass = "mcfc";
                    }
                    <tr class='@myClass'>
                        <td class="c1">
                            @(i + 1)
                        </td>
                        <td class="c2">
                            @Model[i].TeamName
                        </td>
                        <td class="c3">
                            @Model[i].Matches
                        </td>
                        <td class="c4">
                            @Model[i].Won
                        </td>
                        <td class="c5">
                            @Model[i].Points
                        </td>
                        <td class="c5">
                            @Model[i].Average.Value
                        </td>
                    </tr>
                    myClass = null;
                }
            </tbody>
        </table>
    </div>
    <div class="module-footer">
        <a href="/League/Index/@ViewBag.CurrentSeason" title="League Table">Full league table</a>
    </div>
</div>
